<?php
include '../service/InvitationService.class.php';
include '../util/class.log.php';
header("Content-type:text/html;charset=utf-8");

$username = $_POST['username'];
$category = $_POST['category'];
$content = $_POST['content'];
$address = $_POST['address'];
$startTime = $_POST['startTime'];
$endTime = $_POST['endTime'];
$money = $_POST['money'];
$lati = $_POST['lati'];
$long = $_POST['long'];
$currentTime = date('Y年m月d日 H:i',time());

$invitationService = new InvitationService();
$result = $invitationService->post($username, $content,$address, $category, $currentTime, $startTime, $endTime, $money, $long, $lati);

if($result == 1 ) {
	$L = log::get_instance();
	$L->log(0,'用户'.$username.'发帖成功', date('Y-n-j H:m:s'));
	$L->close();
	$array = array('tip' => 1);       //发帖完成
	print_r(json_encode($array));
}else {
	$L = log::get_instance();
	$L->log(0,'用户'.$username.'发帖失败', date('Y-n-j H:m:s'));
	$L->close();
	$array = array('tip' => 0);       //发帖失败
	print_r(json_encode($array));
}
